package com.chen.solution.rpc.commonlib.api;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * @author Chentian
 * @date 2022/3/16
 */

@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class BaseResponse {

    /** 返回结果码  */
    @Builder.Default
    private Integer code = ResultCode.SUCCESS.code;

    /** 返回结果码描述 */
    @Builder.Default
    private String desc = ResultCode.SUCCESS.msg;

    /** 返回错误描述 */
    private String message;

    /** 时间戳 */
    @Builder.Default
    private long timestamp = System.currentTimeMillis();

    public boolean isSuccess() {
        return code == ResultCode.SUCCESS.code;
    }
}
